package org.micropayment.model.xmladapter;

import java.util.Date;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import org.micropayment.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DateAdapter extends XmlAdapter<String, Date> {
	
    private static Logger logger = LoggerFactory.getLogger(DateAdapter.class);

    @Override
    public String marshal(Date date) throws Exception {
        String dateStr = DateUtils.getStringFromDate(date);
        return dateStr;
    }

    @Override
    public Date unmarshal(String dateStr) throws Exception {
        Date date = DateUtils.getDateFromString(dateStr);
        return date;
    }

}
